<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<title>聚焦失焦事件</title>
	</head>
	<body>
		<input type="text" id="user">
		<input type="text" id="number">
	</body>
</html>
<script>
	
	var userInput = document.getElementById('user');
	var numberInput = document.getElementById('number');
	// 获得焦点时走的方法
	userInput.onfocus = function() {
		// console.log("聚焦");
		this.style.background = "red";
	};

	// 失去焦点时走的方法
	userInput.onblur = function() {
		this.style.background = "yellow";
	};




</script>